package DControl;

import java.awt.*;
import java.awt.event.*;

public abstract class DComponent implements DMouseListener{
	int x = 0,y = 0,width = 0,height = 0,arcWidth =6,arcHeight = 6;
	String text = "";
	Color color;
	boolean rasied = true;
	DFrame frame = null;
	DRect responseRect = new DRect();
	int stringWidth;
	int stringHeight;
	static boolean showCursor = false;
	String Class;
	boolean focus = false;
	DMouseListener listener;
	//static boolean focus = false;

	 public void paintComponent(Graphics g)
	 {
		 FontMetrics metrics = g.getFontMetrics(); 
		 stringWidth = metrics.stringWidth(text); 
		 stringHeight = metrics.getHeight(); 
	 }
	 
	 
	 public void repaint()
	 {
		 frame.repaint();
	 }
	 
	 public DMouseListener getDMouseListener()
	 {
		 return listener;
	 }
	 
	 public void addDMouseListener(DMouseListener listener)
	 {
		 this.listener = listener;
	 }
	 
	 public DRect getResponseRect()
	 {
		 return responseRect;
	 }
	 
	 public void setResponseRect(int x_l,int y_l,int x_r,int y_r)
	 {
		 this.responseRect.setRect(x_l, y_l, x_r, y_r);
	 }
	 
	 public void setFocus(boolean focus)
	 {
		 this.focus = focus;
	 }
	 
     public String getClassName()
     {
    	 return Class;
     }
	 
	 public void getDDFrame(DFrame frame)
	 {
		 this.frame = frame;
	 }
	
	 public void setLocation(int x,int y)
	 {
		 this.x = x;
		 this.y = y;
	 }
	 
	 public void setSize(int width,int height)
	 {
		 this.width = width;
		 this.height = height;
	 }
	 
	 public void setColor(Color color)
	 {
		 this.color = color;
	 }
	 
	 public void setText(String text)
	 {
		 this.text = text;
	 }
	 
	 public void getSize()
	 {
		 
	 }
	 
	 public Color getColor()
	 {
		 return color;
	 }
	 
	 public String getText()
	 {
		 return text;
	 }
	 
	    public void mouseEntered(MouseEvent e){}
		
		public void mouseExited(MouseEvent e){}
		
		public void mousePressed(MouseEvent e){}
		
		public void mouseReleased(MouseEvent e){}
		
		public void mouseClicked(MouseEvent e){}
		
		public void keyPressed(KeyEvent e){}
		public void keyTyped(KeyEvent e){}

}
